import { ChangeEvent, useState } from 'react';
interface Props {
	changeVal: (val: string) => void;
}

const Input = ({ changeVal }: Props) => {
	const [val, setVal] = useState('');
	const handleChangeVal = (e: ChangeEvent<HTMLInputElement>) => {
		setVal(e.target.value);
		changeVal(e.target.value);
	};

	return (
		<input
			onChange={(e) => {
				handleChangeVal(e);
			}}
			value={val}
			className="text-lg w-full h-10 outline-none "
			placeholder="ask"
		></input>
	);
};

export default Input;
